using System;
using FastSocket.Server.Messaging;
using FastSocket.SocketBase;

namespace FastSocket.Server.Protocol
{
    public interface IProtocol<TMessage> where TMessage : class,IMessage
    {
        /// <summary>
        /// parse protocol message
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="buffer"></param>
        /// <param name="maxMessageSize"></param>
        /// <param name="readlength"></param>
        /// <returns></returns>
        TMessage Parse(IConnection connection, ArraySegment<byte> buffer, int maxMessageSize, out int readlength);
    }
}